package videoExercises;

import java.util.Comparator;
import java.util.TreeMap;

public class TestTreeMap {
    public static void main(String[] args) {

        TreeMap<Integer ,String> tree1 =new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1 ,Integer o2){
                return o2-o1;
            }
        });
        //Integer、Double按照数字进行升序排列
        //String 按照字母在ascii码表的数字升序进行排序
        tree1.put(1,"小布丁");
        tree1.put(100,"钟薛高");
        tree1.put(3,"好心情");
        tree1.put(2,"老冰棍");
        tree1.put(50,"阿根达斯");
        System.out.println(tree1);
        /*Set<Map.Entry<String, Integer>> entries = tree.entrySet();
        for (Map.Entry<String, Integer> entry : entries) {
            String key =entry.getKey();
            Integer value =entry.getValue();
            System.out.println(key+" "+value);
        }*/

    }
}
